import request, {METHODS} from '@/service/request';
import envConf from '@/conf/env.conf';

/**
 * 获取名片完整信息
 */
export function getBanner({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/banner`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取书单的接口
 */
export function getBookList({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/items`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取配置信息
 */
export function getConfInfo({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/conf`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取书单详情的接口
 */
export function bookDetail({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/itemsInfo`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取分类的接口
 */
export function getClass({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/homeSort`,
        data,
        success,
        fail,
        complete,
    });
}


/**
 * 获取推荐选项的接口
 */
export function getHomeConf({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/homeConf`,
        data,
        success,
        fail,
        complete,
    });
}


/**
 * 获取书籍列表的接口
 */
export function getBooks({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/books`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取书籍列表的接口
 */
export function getBookDetail({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/book`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取不同类别列表接口
 */
export function getClassList({ data, success, fail, complete, type}) {
    return request({
        url: `xcxapi/${type}s`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取分类下是否有二级分类
 */
export function getClassSorts({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/sorts`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 获取不同类别详情接口
 */
export function getClassDetail({ data, success, fail, complete, type}) {
    return request({
        url: `xcxapi/${type}`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 全选书籍
 */
export function shoppingAll({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/shoppingAll`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 书框数量
 */
export function shoppingNum({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/shoppingNum`,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 添加书框
 */
export function addShopping({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/shopping`,
        method: METHODS.POST,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 取消书框
 */
export function delShopping({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/shopping`,
        method: METHODS.DELETE,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 添加心愿单
 */
export function addCollect({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/keep`,
        method: METHODS.POST,
        data,
        success,
        fail,
        complete,
    });
}

/**
 * 取消心愿单
 */
export function delCollect({ data, success, fail, complete}) {
    return request({
        url: `xcxapi/keep`,
        method: METHODS.DELETE,
        data,
        success,
        fail,
        complete,
    });
}
